//@module

exports.DefaultParameters = {

	run(){
		
			'use strict';
	
			function foo(x = 11, y = 31) {
				trace(x + " " + y + "\n");
			}
			
			/*foo(); // 42
			foo( 5, 6 ); // 11
			foo( 0, 42 ); // 42
			foo( 5 ); // 36
			foo( 5, undefined ); // 36 <-- `undefined` is missing
			foo( 5, null ); // 5 <-- null coerces to `0`
			foo( undefined, 6 ); // 17 <-- `undefined` is missing
			foo( null, 6 ); // 6 <-- null coerces to `0`
			trace("\n");*/
			
			function log(param){
				trace(param + " ");
			}
			
			function g(x=log('x'), y=log('y')) {
				return 'DONE'
			}
			
			/*g();
			trace("\n");
			g(1);
			trace("\n");
			g(1,2);*/
			
			
			function bar(val) {
				trace( "bar called!\n" );
				return y + val;
			}
			
			function foo(x = y + 3, z = bar( x )) {
				trace( x + " " + z + "\n");
			}
			
			/*var y = 5;
			foo(); // "bar called"
			// 8 13
			foo( 10 ); // "bar called"
			// 10 15
			y = 6;
			foo( undefined, 10 ); // 9 10*/
			
			/*function ajax(url,cb = function(){}){
				cb();
			}
		
			ajax("url1",function(){
				trace("callback")
			});
			
			ajax("url2");*/
			
			
			function bar(callback = function(){return QUX}) {
				callback && (callback = function(){return QUX})
				{
					const QUX = 3; // can’t be accessed from default value
					callback();
				}
			}
			bar(); // ReferenceError
	}
}
